<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="../../css/app.css"/>
		<style>
			html,
			body {
				background-color: #efeff4;
			}
			.title {
				padding: 20px 15px 10px;
				color: #6d6d72;
				font-size: 15px;
				background-color: #fff;
			}
			.mui-table-view-cell{
				padding:  ;
			}
		</style>
	</head>

	<body>
		<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
			<div class="mui-scroll">
			<div class="title">
				<div class="mui-input-row mui-search">
					<input type="search" class="mui-input-clear" placeholder="">
				</div>
				</div>
				<ul class="mui-table-view">
					<li class="mui-table-view-cell">
						<a href="javascript:;">
							<img class="mui-media-object mui-pull-left" src="../images/muwu.jpg">
							<div class="mui-media-body">
								<h2>华杰煤业</h2>
								<p class='mui-ellipsis'>2018-07-24</p>
								<p class='mui-ellipsis'>任务单号：123456789</p>
								<h2 align="right">3吨</h2>
								<hr>
								<button  type="button" class="mui-btn" style="float: right;">确认
			                	</button>
							</div>
						</a>
					</li>
				</ul>
			</div>
		</div>
		<script src="../js/mui.min.js"></script>
		<script>
			mui.init({
				swipeBack: false,
				pullRefresh: {
					container: '#pullrefresh',
					down: {
						callback: pulldownRefresh
					},
					up: {
						contentrefresh: '正在加载...',
						callback: pullupRefresh
					}
				}
			});
			/**
			 * 下拉刷新具体业务实现
			 */
			function pulldownRefresh() {
				setTimeout(function() {
					var table = document.body.querySelector('.mui-table-view');
					var cells = document.body.querySelectorAll('.mui-table-view-cell');
					for (var i = cells.length, len = i + 3; i < len; i++) {
						var li = document.createElement('li');
						li.className = 'mui-table-view-cell';
						li.innerHTML = '<a href="javascript:;">'+'<img class="mui-media-object mui-pull-left" src="../images/muwu.jpg">'
						               +'<div class="mui-media-body">'+'<h2>company'+'</h2>'
						               +'<p class="mui-ellipsis">year-month-day'+'</p>'
						               +'<p class="mui-ellipsis">任务单号：'+'</p>'
								       +'<h2 align="right">任务总量'+'</h2>'
								       +'<hr>'
								       +'<button  type="button" class="mui-btn" style="float: right;">确认'
								       +'</button>'
							           +'</div>'
						               +'</a>';
						//下拉刷新，新纪录插到最前面；
						table.insertBefore(li, table.firstChild);
					}
					mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
				}, 1000);
			}
			var count = 0;
			/**
			 * 上拉加载具体业务实现
			 */
			function pullupRefresh() {
				setTimeout(function() {
					mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count > 2)); //参数为true代表没有更多数据了。
					var table = document.body.querySelector('.mui-table-view');
					var cells = document.body.querySelectorAll('.mui-table-view-cell');
					for (var i = cells.length, len = i + 20; i < len; i++) {
						var li = document.createElement('li');
						li.className = 'mui-table-view-cell';
							li.innerHTML = '<a href="javascript:;">'+'<img class="mui-media-object mui-pull-left" src="../images/muwu.jpg">'
						               +'<div class="mui-media-body">'+'<h2>company'+'</h2>'
						               +'<p class="mui-ellipsis">year-month-day'+'</p>'
						               +'<p class="mui-ellipsis">任务单号：'+'</p>'
								       +'<h2 align="right">任务总量'+'</h2>'
								       +'<hr>'
								       +'<button  type="button" class="mui-btn" style="float: right;">确认'
								       +'</button>'
							           +'</div>'
						               +'</a>';
						table.appendChild(li);
					}
				}, 1000);
			}
		</script>
	</body>

</html>